export default function(){
    function render(){

    }
    $.extend(render.prototype,{
        init : function(list , type){
            if(type == "goods_list" ){
                return this.renderGoodsList(list);
            }
            if(type == "detaile_list"){
                return this.renderDetaileList(list);
            }
        },
        renderGoodsList : function(data){
            //good_id  => data-id="${item.goods_id}"
            var load_url = "http://jp.juancdn.com/juanpi/images/list/loading.gif?ts=20181022174388-1&sv=449ce9ee"
            var html = "";
            var img_text = "";
            $.each(data,function(index,item){
                img_text = `<a href="./detail.html#${item.goods_id}" target="_blank" data-value="goods1_1">
                                <img class="goods-list-img" src="${load_url}" alt="" real-src="${item.pic_url}">
                            </a>`
                html += `<li>
                            <div class="list-goods">
                                <div class="goods-pic">
                                    <div class="pic-img">
                                        ${img_text}
                                    </div>
                                </div>
                                <div class="goods-price">
                                    <span class="price-current">
                                        <em>￥${item.cprice}</em>
                                    </span>
                                    <span class="des-other">
                                        <span class="price-old">
                                            <em>￥${item.oprice}</em>
                                        </span>
                                    </span>
                                </div>
                                <h3 class="goods-title">
                                    <a href="./detail.html#${item.goods_id}" target="_blank">${item.title}</a>                  
                                    <span class="sold">${item.residue}</span>               
                                </h3>
                            </div>
                        </li>`
            })
            return html;
        },
    })
    return new render();
}
